import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import LoginView from '../views/Login/AuthView.vue'
import index from '../views/IndexView.vue'
import LoginC from '../components/login.vue'
import RegisterC from '../components/register.vue'
import managerViewVue from '@/views/manager/managerView.vue'
import ShopInfoView from '@/views/manager/shop/ShopInfoView.vue'
import GoodsInfoView from '@/views/manager/goods/GoodsInfoView.vue'
import ManagerIndexView from '../views/manager/ManagerIndexView.vue';
import UserinfoView from '../views/manager/user/UserInfoView.vue'
import DiscountView from '../views/manager/discount/DiscountInfoView.vue'
import DisSendInfoViewVue from '@/views/manager/discount/DisSendInfoView.vue'


const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'index',
    component: index
  },
  {
    path: '/auth',
    component: LoginView,
    children: [
      {
        path: 'login',
        component: LoginC
      },
      {
        path: 'register',
        component: RegisterC
      }
    ]
  },
  {
    path: '/manager',
    component: managerViewVue,
    children: [{
      path: 'shop',
      component: ShopInfoView
    }, {
      path: 'goods',
      component: GoodsInfoView
    }, {
      path: 'index',
      component: ManagerIndexView
    },
    {
      path: 'user',
      component: UserinfoView
    },
    {
      path: 'discount',
      component: DiscountView
    },
    {
      path: 'sendDiscount',
      component: DisSendInfoViewVue
    }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
